﻿<UserControl 
  x:Class="ContentControl3D_Demo.Samples.RotationDestinationSample"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:thriple="http://thriple.codeplex.com/"
  >

  <DockPanel>
    <Grid DockPanel.Dock="Bottom">
      <CheckBox 
        Content="Show Detailed View" 
        HorizontalAlignment="Center"
        IsChecked="{Binding Path=ShowDetailedView}" 
        Margin="0,0,0,6"
        />
    </Grid>
    
    <ScrollViewer>
      <ScrollViewer.Background>
        <ImageBrush ImageSource="Images/TravelDestination.jpg" Opacity="0.25" />
      </ScrollViewer.Background>
      
      <ItemsControl ItemsSource="{Binding Path=Things}">
        <ItemsControl.Resources>
          <DataTemplate x:Key="FrontTemplate">
            <Border Background="#88FFFFFF" BorderBrush="Black" BorderThickness="1" Width="100" Height="100">
              <TextBlock Text="{Binding Path=Name}" TextWrapping="Wrap" HorizontalAlignment="Center" />
            </Border>
          </DataTemplate>

          <DataTemplate x:Key="BackTemplate">
            <Border Background="#88FFFFFF" BorderBrush="Black" BorderThickness="1" Width="100" Height="100">
              <Image Source="{Binding Path=ImageUri}" />
            </Border>
          </DataTemplate>
        </ItemsControl.Resources>

        <ItemsControl.ItemTemplate>
          <DataTemplate>
            <thriple:ContentControl3D 
              BackContent="{Binding}"
              BackContentTemplate="{StaticResource BackTemplate}"
              Content="{Binding}"
              ContentTemplate="{StaticResource FrontTemplate}"
              Loaded="ContentControl3D_Loaded"
              Width="270" Height="270"
              />
          </DataTemplate>
        </ItemsControl.ItemTemplate>
        
        <ItemsControl.ItemsPanel>
          <ItemsPanelTemplate>
            <WrapPanel />
          </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
      </ItemsControl>
    </ScrollViewer>
  </DockPanel>
  
</UserControl>